import service from '@/service/index'
import type { LoginForm } from '@/types'

// 用户登录
export const login = (loginForm: LoginForm) => {
  // 返回的数据格式可以和服务端约定
  return service({
    method: 'get',
    url: '/admin/login',
    params: loginForm,
  })
}

// 获取验证码
export const getCaptcha = () => {
  return service({
    method: 'get',
    url: '/admin/captcha',
  })
}

// 获取登录用户菜单
export function getInfo() {
  return service({
    method: 'get',
    url: `/admin/user`,
  })
}

// 获取菜单
export const getMenus = () => {
  return service({
    method: 'get',
    url: `/admin/menus`,
  })
}
